package _13_prototype_pattern.v_clone.deep_clone;

import java.util.ArrayList;

/**
 * @Description: 
 * @Auther: 2019/6/20 17:48 by zhang.jy
 */
public class Thing implements Cloneable {
	//定义一个私有变量
	private ArrayList<String> arrayList = new ArrayList<String>();

	@Override
	public Thing clone() {
		Thing thing = null;
		try {
			thing = (Thing) super.clone();
			thing.arrayList = (ArrayList<String>) this.arrayList.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return thing;
	}

	//设置HashMap的值
	public void setValue(String value) {
		this.arrayList.add(value);
	}

	//取得arrayList的值
	public ArrayList<String> getValue() {
		return this.arrayList;
	}
}